//
//  HomeViewController.m
//  7.23 半糖
//
//  Created by dllo on 16/7/23.
//  Copyright © 2016年 高雅馨. All rights reserved.
//

#import "HomeViewController.h"

@interface HomeViewController ()<UISearchBarDelegate>
@property (nonatomic, strong) UISearchBar *BYsearchTextFd;

@end

@implementation HomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UISearchBar *bar = [[UISearchBar alloc] init];
    self.navigationItem.titleView = bar;
    self.BYsearchTextFd = [[UISearchBar alloc]initWithFrame:CGRectMake(50, 33,self.view.frame.size.width-100,31)];
    self.BYsearchTextFd.placeholder = @"搜索值得买的好物";
    self.BYsearchTextFd.keyboardType = UIKeyboardTypeWebSearch;
    self.view.backgroundColor = [UIColor whiteColor];
    self.BYsearchTextFd.barStyle = UIBarStyleDefault;
    self.navigationItem.titleView = self.BYsearchTextFd;
    self.BYsearchTextFd.delegate = self;
    UIButton *cancelbutton = [UIButton buttonWithType: UIButtonTypeSystem];
    cancelbutton.frame = CGRectMake(300, 10, 50, 50);
    [cancelbutton setImage:[UIImage imageNamed:@"sign_bar_icon"] forState:UIControlStateNormal];
    cancelbutton.tintColor = [UIColor colorWithRed:0.94 green:0.41 blue:0.38 alpha:1.00];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:cancelbutton];
    [cancelbutton addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
}
- (void)buttonClick:(UIButton *)button {
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
